package org.jeecg.common.enmus;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * @author : syf
 * @date : 2023-03-12
 */

public enum YctdInfoEnum {

    PRICE_URL(1,"价格","priceUrl"),
    SUPPLY_URL(2,"供应","supplyUrl"),
    BUY_URL(3,"求购","buyUrl"),
    EFFICACY_URL(4,"功效","efficacyUrl"),


    ;


    /**
     * 根据类型找名字
     * @param type
     * @return
     */
    public static String findTyToName(Integer type){
        for (YctdInfoEnum value : YctdInfoEnum.values()) {
            if(Objects.equals(value.getType(), type)){
                return value.getName();
            }
        }
        return null;
    }

    /**
     * 根据名字找类型
     * @param name
     * @return
     */
    public static Integer findNameToType(String name){
        for (YctdInfoEnum value : YctdInfoEnum.values()) {
            if(Objects.equals(value.getName(), name)){
                return value.getType();
            }
        }
        return null;
    }

    /**
     * 根据名字找字段名字
     * @param name
     * @return
     */
    public static String findNameToField(String name){
        for (YctdInfoEnum value : YctdInfoEnum.values()) {
            if(Objects.equals(value.getName(), name)){
                return value.getField();
            }
        }
        return null;
    }


    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private Integer type;
    private String name;
    private String field;



    YctdInfoEnum(Integer type, String name,String field) {
        this.type = type;
        this.name = name;
        this.field= field;
    }



}

